package com.xjscrm.console.web.operatePlan;

import com.xjscrm.console.param.operatePlan.*;
import com.xjscrm.console.service.customer.operatePlan.GroupWelcomeBatchService;
import com.xjscrm.console.service.customer.operatePlan.GroupWelcomeService;
import com.xjscrm.console.vo.GroupWelcomeDeviceVo;
import com.xjscrm.console.vo.GroupWelcomeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "入群欢迎语方案管理", tags = "入群欢迎语方案管理")
@RestController
@RequestMapping(value = "/group/welcome")
public class GroupWelcomeController {

    @Autowired
    private GroupWelcomeService groupWelcomeService;

    @Autowired
    private GroupWelcomeBatchService groupWelcomeBatchService;

    @ApiOperation(value = "新增入群欢迎语方案", notes = "新增入群欢迎语方案", response = Boolean.class)
    @PostMapping(value = "/addGroupWelcomePlan")
    public Object addGroupWelcomePlan(@RequestBody GroupWelcomeDto groupWelcomeDto)throws Exception{
           groupWelcomeService.addGroupWelcomePlan(groupWelcomeDto);
          return true;
    }

    @ApiOperation(value = "修改入群欢迎语方案", notes = "修改入群欢迎语方案", response = Boolean.class)
    @PostMapping(value = "/updateGroupWelcomePlan")
    public Object updateGroupWelcomePlan(@RequestBody GroupWelcomeDto groupWelcomeDto)throws Exception{
        groupWelcomeService.updateGroupWelcomePlan(groupWelcomeDto);
        return true;
    }


    @ApiOperation(value = "获取入群欢迎语方案列表", notes = "获取入群欢迎语方案列表", response = GroupWelcomeVo.class)
    @PostMapping(value = "/getGroupWelcomePlanList")
    public Object getGroupWelcomePlanList(@RequestBody GroupWelcomeQuery groupWelcomeQuery)throws Exception{
        return groupWelcomeService.getGroupWelcomePlanList(groupWelcomeQuery);
    }


    @ApiOperation(value = "获取入群欢迎语方案详情", notes = "获取入群欢迎语方案详情", response = GroupWelcomeVo.class)
    @PostMapping(value = "/getGroupWelcomePlanDetail")
    public Object getGroupWelcomePlanDetail(@RequestBody GroupWelcomeDto groupWelcomeDto)throws Exception{
        return groupWelcomeService.getGroupWelcomePlanDetail(groupWelcomeDto);
    }


    @ApiOperation(value = "删除入群欢迎语方案", notes = "删除入群欢迎语方案", response = Boolean.class)
    @PostMapping(value = "/delGroupWelcomePlan")
    public Object delGroupWelcomePlan(@RequestBody GroupWelcomeDto groupWelcomeDto)throws Exception{
         groupWelcomeService.delGroupWelcomePlan(groupWelcomeDto);
        return true;
    }

    @ApiOperation(value = "批量新增入群欢迎语方案和机器人关系", notes = "批量新增入群欢迎语方案和机器人关系", response = Boolean.class)
    @PostMapping(value = "/batchAddPlanDevice")
    public Object batchAddPlanDevice(@RequestBody GroupWelcomePlanDeviceDto groupWelcomePlanDeviceDto)throws Exception{
        groupWelcomeBatchService.batchAddPlanDevice(groupWelcomePlanDeviceDto);
        return true;
    }

    @ApiOperation(value = "批量修改入群欢迎语方案和机器人关系", notes = "批量修改入群欢迎语方案和机器人关系", response = Boolean.class)
    @PostMapping(value = "/batchUpdatePlanDevice")
    public Object batchUpdatePlanDevice(@RequestBody GroupWelcomePlanDeviceDto groupWelcomePlanDeviceDto)throws Exception{
        groupWelcomeBatchService.batchUpdatePlanDevice(groupWelcomePlanDeviceDto);
        return true;
    }


    @ApiOperation(value = "批量删除入群欢迎语方案和机器人关系", notes = "批量删除入群欢迎语方案和机器人关系", response = Boolean.class)
    @PostMapping(value = "/batchDelPlanDevice")
    public Object batchDelPlanDevice(@RequestBody GroupWelcomePlanDeviceDto groupWelcomePlanDeviceDto)throws Exception{
        groupWelcomeBatchService.batchDelPlanDevice(groupWelcomePlanDeviceDto);
        return true;
    }


    @ApiOperation(value = "查询入群欢迎语方案和机器人关系列表", notes = "查询入群欢迎语方案和机器人关系列表", response = GroupWelcomeDeviceVo.class)
    @PostMapping(value = "/getPlanDeviceList")
    public Object getPlanDeviceList(@RequestBody GroupWelcomeDeviceQuery groupWelcomeDeviceQuery)throws Exception{
        return   groupWelcomeService.getPlanDeviceList(groupWelcomeDeviceQuery);
    }


    @ApiOperation(value = "查询入群欢迎语应用的机器人ID列表", notes = "查询入群欢迎语应用的机器人ID列表", response = Long.class)
    @PostMapping(value = "/getUsedDeviceUniqueIds")
    public Object getUsedDeviceUniqueIds(@RequestBody GroupWelcomeDto groupWelcomeDto)throws Exception{
        return groupWelcomeService.getUsedDeviceUniqueIds(groupWelcomeDto);
    }

}
